package cn.xingzhen.jfield.componet;

import javax.swing.*;
import java.awt.*;

/**
 * @author wenqiang
 * @date 2023/5/6
 * @comment ..
 */
public class XzRadioButton extends JRadioButton {

    public XzRadioButton(String title, boolean selected, int width) {
        super(title, selected);
        setPreferredSize(new Dimension(width, XzUIConfigure.DEFAULT_COMPONENT_HEIGHT));
        initDefault();
    }

    public XzRadioButton(String text, boolean selected) {
        super(text, selected);
        setPreferredSize(new Dimension(XzUIConfigure.DEFAULT_WIDTH_CHECKBOX, XzUIConfigure.DEFAULT_COMPONENT_HEIGHT));
        initDefault();
    }

    private void initDefault() {
        setBorderPainted(true);
        if(XzUIConfigure.SHOW_BORDER) {
            setBorder(BorderFactory.createLineBorder(XzUIConfigure.BORDER_COLOR));
        } else {
            setBorder(BorderFactory.createCompoundBorder());
        }
    }
}

